home *** CD-ROM | disk | FTP | other *** search
/ Run Magazine ReRun 1989 Special Issue / rerun-1989-special-issue.d64 / show of hands (.txt) < prev    next >
Commodore BASIC  |  2022-09-20  |  6KB  |  209 lines

  1. 100 rem* a show of hands *
  2. 110 rem* an sign language alphabet learning program *
  3. 120 rem* by jack r. farrah  11/87 *
  4. 130 poke55,255:poke56,116:rem lower top of basic memory below ml and pic file
  5. 140 print"[147]"spc(10)"loading picture file"
  6. 150 if a=0 then a=1:load"picture file",8,1
  7. 160 clr:rem set top of string variables to top of basic
  8. 170 print"[147]"spc(9)"installing ml routines"
  9. 180 ml=29952:rem start address of ml routines
  10. 190 for x=1 to 412
  11. 200 read a:sum=sum+a:next
  12. 210 if sum<>54225 then print "checksum error!":stop
  13. 220 restore
  14. 230 for x=1 to 412
  15. 240 read a:poke ml,a:ml=ml+1:next
  16. 250 dim a(25):rem 26 element alphabet array
  17. 260 print"[147]"spc(12)"a show of hands":print
  18. 270 printspc(6)"the american manual alphabet":print:print
  19. 280 printspc(11)"(1) signs test":print
  20. 290 printspc(11)"(2) text to signs":print
  21. 300 printspc(11)"(3) quit program":print
  22. 310 printspc(12):input"select(1-3)";a$
  23. 320 if a$="1"then 360
  24. 330 if a$="2"then 940
  25. 340 if a$="3"then end
  26. 350 goto 310
  27. 360 rem *signs test routine*
  28. 370 print"[147]"spc(15)"signs test":print
  29. 380 printspc(7)"(1) time limit per letter":print
  30. 390 printspc(7)"(2) no time limit":print
  31. 400 printspc(7)"(3) return to main menu":print
  32. 410 tflag=0:rem flag to show if timing required
  33. 420 printspc(12):input"select(1-3)";a$
  34. 430 if a$="1"then 460
  35. 440 if a$="2"then 520
  36. 450 if a$="3"then 260
  37. 460 rem* time limit test *
  38. 470 print:printspc(10)"1=fastest  9=slowest"
  39. 480 printspc(10):input"select speed(1-9) ";a$
  40. 490 a=10*(val(a$)):d=a:if a$<"1" or a$>"9" then 480
  41. 500 tflag=1:rem show time loop required
  42. 510 rem*no time limit routine starts*
  43. 520 rem*fill array with ascii codes for letters*
  44. 530 l=65
  45. 540 for x=0 to 25
  46. 550 a(x)=l
  47. 560 l=l+1
  48. 570 next
  49. 580 sys 30079:rem clear bit map
  50. 590 sys 29952:rem switch in raster interrupt
  51. 600 n=rnd(-ti):rem set up for new random sequence
  52. 610 n=rnd(1)*(25-0)+0:rem random # from 0 to 25
  53. 620 if a(n)=0 then print:print"wait...":goto 830
  54. 630 b=a(n):c=n:poke780,b:rem save # in b and array element in c
  55. 640 sys 30128:rem display sign
  56. 650 print"[147]":poke214,21:print"press key of sign's letter."
  57. 660 get a$
  58. 670 if a$=""and tflag=1 then 760:rem do timing loop if flag set
  59. 680 if a$=""goto 660
  60. 690 if a$=chr$(b) then print:print"correct!":a(c)=0:a=d:wait203,64:goto 710
  61. 700 print:print"sorry. this sign is for the letter "chr$(b)"[146]":a=d
  62. 710 print"hit c to continue, m for menu":wait203,64
  63. 720 get a$:if a$="" then 720
  64. 730 if a$="c" then 610
  65. 740 if a$="m" then sys 30272:goto 360:rem reset to normal interrupt
  66. 750 goto 720
  67. 760 rem*timing loop*
  68. 770 for y=1 to 25:next y
  69. 780 a=a-1
  70. 790 if a>0 then 660
  71. 800 if a=0 then print"time expired!"
  72. 810 print"this sign is for the letter "chr$(b)"[146]":a=d:rem reset delay value
  73. 820 goto 710
  74. 830 rem* array element found to be 0*
  75. 840 rem*check if all elements used*
  76. 850 x=0
  77. 860 e=a(x)
  78. 870 if e<>0 then n=x:goto 630:rem take next non-zero element
  79. 880 x=x+1:if x=26 then 900
  80. 890 goto 860
  81. 900 print"excellent! you have completed the"spc(7)"alphabet of signs."
  82. 910 print"hit any key to return to menu."
  83. 920 get a$:if a$="" then 920
  84. 930 a$="m":goto 740
  85. 940 rem*text to signs routine*
  86. 950 print"[147]"spc(13)"text to signs":print:print
  87. 960 printspc(3)"(1) show letters as entered":print
  88. 970 printspc(3)"(2) enter text string for display":print
  89. 980 printspc(3)"(3) return to main menu":print
  90. 990 printspc(12):input"select (1-3) ";a$
  91. 1000 if a$="1" then print:poke214,21:print:sys 30079:sys 29952:goto 1040
  92. 1010 if a$="2" then 1120
  93. 1020 if a$="3" then 260
  94. 1030 goto 990
  95. 1040 rem*show letters as entered routine*
  96. 1050 print:print"enter letters a-z."
  97. 1060 print"any other keys return to menu."
  98. 1070 get a$:if a$="" then 1070
  99. 1080 if a$<"a" or a$>"z" then sys 30272:goto 950
  100. 1090 b=asc(a$):print a$
  101. 1100 poke780,b:sys 30128:rem display sign
  102. 1110 goto 1070
  103. 1120 rem*enter text string routine*
  104. 1130 print"[147]"spc(9)"display text strings":print
  105. 1140 printspc(4)"maximum length of text string is"
  106. 1150 printspc(12)"255 characters.":print
  107. 1160 print"only letters (a-z) and spaces recognized"
  108. 1170 printspc(6)"display time per character "
  109. 1180 printspc(5)"can be varied for practicing."
  110. 1190 print:printspc(13)"1=fast  9=slow"
  111. 1200 print:printspc(10):input"select speed (1-9) ";a$
  112. 1210 if val(a$)<1 or val(a$)>9 then 1200
  113. 1220 b=val(a$)
  114. 1230 print:poke214,21:print:sys 30079:sys 29952
  115. 1240 print"enter text string."
  116. 1250 gosub 1550
  117. 1260 print:c=len(a$)
  118. 1270 if c>0 then 1330
  119. 1280 print"hit c to continue, m to return to menu"
  120. 1290 get a$:if a$="" then 1290
  121. 1300 if a$<>"c" or a$<>"m" then 1280
  122. 1310 if a$="m" then sys 30272:goto 950
  123. 1320 goto 1240
  124. 1330 for x=1 to c
  125. 1340 d$=mid$(a$,x,1)
  126. 1350 d=asc(d$)
  127. 1360 if d=32 then print" ";:goto 1410:rem ignore space but print it
  128. 1370 if d<65 or d>90 then print"?";:goto 1410
  129. 1380 poke780,d:sys 30128:rem display sign
  130. 1390 print d$;
  131. 1400 gosub 1490:rem do timing loop
  132. 1410 next x
  133. 1420 rem*string has now been displayed*
  134. 1430 print:printspc(5)"hit c to enter another string"
  135. 1440 printspc(10)"m to return to menu"
  136. 1450 get a$:if a$="" then 1450
  137. 1460 if a$<>"c" and a$<>"m" then 1430
  138. 1470 if a$="c" then 1240
  139. 1480 sys 30272:goto 950
  140. 1490 rem*timing subroutine b=timing value*
  141. 1500 for y=1 to b
  142. 1510 for z=1 to 100:next z
  143. 1520 next y
  144. 1530 return
  145. 1540 rem* input text string routine *
  146. 1550 y=0:a$=""
  147. 1560 get b$
  148. 1570 poke204,0:rem blink cursor
  149. 1580 if b$="" then 1560
  150. 1590 if b$=chr$(13) then poke204,1:return
  151. 1600 if b$=chr$(20) and y>1 then a$=mid$(a$,1,y-1):print b$;:y=y-1:goto 1560
  152. 1610 if b$=chr$(20) and y=0 then goto 1560
  153. 1620 print b$;:a$=a$+b$:y=y+1
  154. 1630 if y=255 then poke 204,0:print:print"max string length!":print:return
  155. 1640 goto 1560
  156. 1650 rem* data for ml routines *
  157. 1660 data 120,169,127,141,13,220,169,1
  158. 1670 data 141,26,208,169,217,141,18,208
  159. 1680 data 169,24,141,17,208,169,0,141
  160. 1690 data 173,117,173,0,221,141,174,117
  161. 1700 data 173,24,208,141,175,117,169,50
  162. 1710 data 141,20,3,169,117,141,21,3
  163. 1720 data 88,96,169,15,141,25,208,173
  164. 1730 data 173,117,240,34,173,17,208,9
  165. 1740 data 32,141,17,208,169,217,141,18
  166. 1750 data 208,173,0,221,41,252,141,0
  167. 1760 data 221,169,8,141,24,208,169,0
  168. 1770 data 141,173,117,76,49,234,169,27
  169. 1780 data 141,17,208,173,175,117,141,24
  170. 1790 data 208,173,174,117,141,0,221,169
  171. 1800 data 49,141,18,208,169,1,141,173
  172. 1810 data 117,104,168,104,170,104,64,162
  173. 1820 data 0,169,1,157,0,192,157,250
  174. 1830 data 192,157,244,193,157,238,194,232
  175. 1840 data 224,250,208,239,169,0,133,251
  176. 1850 data 169,224,133,252,169,0,168,145
  177. 1860 data 251,200,208,251,230,252,166,252
  178. 1870 data 224,255,208,243,96,0,0,0
  179. 1880 data 233,65,10,170,189,104,118,133
  180. 1890 data 251,189,105,118,133,252,169,228
  181. 1900 data 133,254,169,40,133,253,169,0
  182. 1910 data 141,61,118,141,60,118,168,170
  183. 1920 data 140,61,118,172,60,118,177,251
  184. 1930 data 201,254,240,16,200,32,22,118
  185. 1940 data 140,60,118,172,61,118,32,29
  186. 1950 data 118,76,208,117,200,32,22,118
  187. 1960 data 177,251,141,62,118,200,32,22
  188. 1970 data 118,177,251,141,63,118,200,32
  189. 1980 data 22,118,140,60,118,172,61,118
  190. 1990 data 173,62,118,32,29,118,206,63
  191. 2000 data 118,208,245,76,208,117,192,0
  192. 2010 data 208,2,230,252,96,145,253,200
  193. 2020 data 192,112,208,20,160,0,232,224
  194. 2030 data 16,240,14,169,64,24,101,253
  195. 2040 data 133,253,144,2,230,254,230,254
  196. 2050 data 96,104,104,96,0,0,0,0
  197. 2060 data 120,169,129,141,13,220,169,0
  198. 2070 data 141,26,208,169,155,141,17,208
  199. 2080 data 173,174,117,141,0,221,173,175
  200. 2090 data 117,141,24,208,169,49,141,20
  201. 2100 data 3,169,234,141,21,3,88,96
  202. 2110 data 174,119,11,121,144,122,253,123
  203. 2120 data 168,125,252,126,158,128,6,130
  204. 2130 data 63,131,179,132,93,135,234,136
  205. 2140 data 133,138,2,140,132,141,20,143
  206. 2150 data 197,144,81,146,204,147,243,148
  207. 2160 data 58,150,202,151,130,153,75,155
  208. 2170 data 202,156,70,158
  209.